package com.dhecp.project.finance.service.impl;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.alibaba.fastjson.JSON;
import com.dhecp.common.core.domain.AjaxResult;
import com.dhecp.common.utils.MessageUtils;
import com.dhecp.project.finance.domain.AccountDetailedForCompanyDJ;
import com.dhecp.project.storage.domain.Putaway;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dhecp.core.constant.DataFiltering;
import com.dhecp.core.utils.PageUtils;
import com.dhecp.project.common.service.impl.BaseModuleServiceImpl;
import com.dhecp.project.finance.domain.AccountCountForCompany;
import com.dhecp.project.finance.mapper.AccountCountForCompanyMapper;
import com.dhecp.project.finance.service.AccountCountForCompanyService;
import com.dhecp.project.hr.domain.OperateCompanyApply;
import com.dhecp.project.system.service.SysDictionaryForFieldService;

/**
 * 公司实时资金 服务层
 *
 * @author DH-Xxj
 * @version 2022年10月19日
 */
@Service
public class AccountCountForCompanyServiceImpl extends BaseModuleServiceImpl implements AccountCountForCompanyService {

    @Autowired
    private AccountCountForCompanyMapper businessMapper;

    @Autowired
    private SysDictionaryForFieldService dictionaryForFieldService;
	
	/**
	 * 根据公司全称查找
	 */
	@Override
	public AccountCountForCompany findByShortName(String shortName) {	//服务器名,用于区分当前服务器附件数
		return businessMapper.findByShortName(shortName);
	}


    /**
     * 查询
     *
     * @param params
     * @return List - AccountCountForCompany
     * @throws Exception
     * @author DH-Xxj
     */
    @Override
    public List<AccountCountForCompany> queryList(Map<String, Object> params) throws Exception {
        params.put(DataFiltering.TABLE_ALIAS, "t1");    //查询表别名
        params.put(DataFiltering.DATA_WHERE, dictionaryForFieldService.getWhereStr(params));    //常规查询条件SQL语句
        params.put(DataFiltering.DATA_SCODE, dictionaryForFieldService.getDataScode(params));    //数据权限查询条件SQL语句
        if (params.get("field") == null || params.get("field") == "") {
            String orderBy = "vGsBm asc";
            PageUtils.startPageOrder(orderBy);
        } else {
            PageUtils.startPage();
        }
        return businessMapper.selectAll(params);
    }


    /**
     * 修改负债额度
     *
     * @param params
     * @return
     * @author DH-Xxj
     */
    @Override
    public AjaxResult updateType(Map<String, Object> params) {
		AccountCountForCompany item = JSON.parseObject(params.get("infoItem").toString(), AccountCountForCompany.class);
		businessMapper.update(item);
        return AjaxResult.success(MessageUtils.message("module.success.issuccess"));
    }


    /**
     * 根据公司编码冻结资金
     */
    @Override
    public List<AccountDetailedForCompanyDJ> findByDj(String vGsBm) {	//服务器名,用于区分当前服务器附件数
        return businessMapper.findByDjNew(vGsBm);
    }

}
